package com.sky.controller.user;

import com.sky.result.Result;
import com.sky.service.common.DishService;
import com.sky.vo.DishVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * C端：菜品控制器
 * @author zgp
 * @version V1.0
 * @date 2025-01-25 15:25
 */
@Slf4j
@Api(tags = "菜品相关接口")
@RestController("userDishController")
@RequestMapping("/user/dish")
public class DishController {
    @Autowired
    private DishService dishService;

    @ApiOperation("根据分类查询菜品")
    @GetMapping("/list")
    public Result<List<DishVO>> getDishsByCategoryId(Integer categoryId){
        log.info("根据分类id查询菜品列表，categoryId：{}", categoryId);
        return Result.success(dishService.getEnableDishByCategoryId(categoryId));
    }
}
